package com.company.cloud.mall.modules.api.fallback;

import org.springframework.stereotype.Component;

import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.mall.modules.api.response.OrderModel;
import com.company.cloud.mall.modules.api.response.OrderRefundsModel;
import com.company.cloud.mall.modules.api.response.OrderReturnsModel;
import com.company.cloud.mall.modules.api.service.MallOrderRemoteService;

import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;


@Log4j2
@Component
public class MallOrderRemoteServiceFallbackFactory implements FallbackFactory<MallOrderRemoteService>{

	@Override
	public MallOrderRemoteService create(Throwable cause) {
		return new MallOrderRemoteService() {
			
			@SuppressWarnings("unchecked")
			@Override
			public BaseClientResult<OrderModel> orderById(String sn) {
				return BaseClientResult.callbackError();
			}

			@SuppressWarnings("unchecked")
			@Override
			public BaseClientResult<OrderRefundsModel> orderRefundsById(String sn) {
				return BaseClientResult.callbackError();
			}

			@SuppressWarnings("unchecked")
			@Override
			public BaseClientResult<OrderReturnsModel> orderReturnsById(String sn) {
				return BaseClientResult.callbackError();
			}
		};
	}

}
